package com.aaa.train.service.impl;

import com.aaa.common.entity.LayUiTable;
import com.aaa.common.entity.MyConstants;
import com.aaa.common.entity.TbAssessmentResult;
import com.aaa.common.entity.TbTrainer;
import com.aaa.train.dao.TbAssessmentResultDao;
import com.aaa.train.service.TbAssessmentResultService;
import com.baomidou.mybatisplus.plugins.pagination.PageHelper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 考核结果表 服务实现类
 * </p>
 *
 * @author wang
 * @since 2020-07-29
 */
@Service
public class TbAssessmentResultServiceImpl extends ServiceImpl<TbAssessmentResultDao, TbAssessmentResult> implements TbAssessmentResultService {
    @Autowired
    private  TbAssessmentResultDao resultDao;
    /*
     * description: 查询
      * @param null
     * @return
     */
    
    @Override
    public LayUiTable selectAll(Integer page, Integer limit,String userName) {
        PageHelper.startPage(page,limit);
        List<Map> mapList = resultDao.selectAll(userName);
        PageInfo pageInfo = new PageInfo(mapList);
        LayUiTable layUiTable = new LayUiTable();
        layUiTable.setCode(MyConstants.OPERATION_SUCCESS_CODE);
        layUiTable.setMsg(MyConstants.OPERATION_SUCCESS_MESSAGE);
        layUiTable.setData(pageInfo.getList());
        layUiTable.setCount(new Long(pageInfo.getTotal()).intValue());
        return layUiTable;
    }

    @Override
    public List<Map> selectTrainer() {
        List<Map> tbTrainerList = resultDao.selectTrainer();
        return tbTrainerList;
    }

    @Override
    public List<Map> selectUser() {
        return resultDao.selectUser();
    }
}
